package ph.com.gs3.formalistics.model.tables;

public class OutgoingDocumentsTable extends AbstractDataTable {

	public static final String TAG = OutgoingDocumentsTable.class.getSimpleName();

	public static final String NAME = "Outgoing_Documents";

	public static final String COL_ID = "_id";
	public static final String COL_SERVER = "server";
	public static final String COL_DOCUMENT_WEB_ID = "document_web_id";
	public static final String COL_DOCUMENT_FORM_WEB_ID = "document_form_web_id";
	public static final String COL_DOCUMENT_FORM_NAME = "document_form_name";

	public static final String COL_ISSUED_BY_USER_ID = "issued_by_user_id";
	public static final String COL_DATE_ISSUED = "date_issued";
	public static final String COL_FIELD_VALUES_JSON = "field_values_json";
	public static final String COL_ACTION = "action";
	public static final String COL_ERROR_MESSAGE = "error_message";

	@Override
	public String[] getTableColumns() {
		return new String[] { COL_ID, COL_SERVER, COL_DOCUMENT_WEB_ID, COL_DOCUMENT_FORM_WEB_ID,
		        COL_DOCUMENT_FORM_NAME, COL_ISSUED_BY_USER_ID, COL_DATE_ISSUED,
		        COL_FIELD_VALUES_JSON, COL_ACTION, COL_ERROR_MESSAGE };
	}

	@Override
	protected String getCreateTableQuery() {
		// @formatter:off
		return "CREATE TABLE " + NAME 	+ "(" 
				+ COL_ID 					+ " INTEGER PRIMARY KEY AUTOINCREMENT, "
				+ COL_SERVER 				+ " TEXT NOT NULL, "
				+ COL_DOCUMENT_WEB_ID 		+ " TEXT NOT NULL, "
		        + COL_DOCUMENT_FORM_WEB_ID 	+ " TEXT NOT NULL, "
		        + COL_DOCUMENT_FORM_NAME 	+ " TEXT NOT NULL, "
		        + COL_ISSUED_BY_USER_ID 	+ " TEXT NOT NULL, " 
				+ COL_DATE_ISSUED 			+ " TEXT NOT NULL, "
				+ COL_FIELD_VALUES_JSON 	+ " TEXT NOT NULL, "
				+ COL_ACTION 				+ " TEXT NOT NULL, "
		        + COL_ERROR_MESSAGE 		+ " TEXT " + "); ";
		// @formatter:on
	}

	@Override
	protected String getTableName() {
		return NAME;
	}

}
